<?php
/**
 * User: hjd-yao
 * Date: 2019/5/15
 * Time: 17:42
 */

namespace App\Helpers\Traits;


trait ResponseType
{
    public function responseMethod($data,$status = 404)
    {
        if (\request()->ajax()) {
            return response()->json($data,$status);
        } else {
            request()->flash();
            return redirect($data['url'])->with('errors',$data['msg']??'');
        }
    }
}